//
//  PracticalSecView.m
//  MyProject
//
//  Created by dllo on 15/11/16.
//  Copyright © 2015年 蓝鸥0825. All rights reserved.
//

#import "PracticalSecView.h"
#import "UIImageView+WebCache.h"

#define WIDTH self.frame.size.width
#define HEIGHT self.frame.size.height

@implementation PracticalSecView

- (instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        [self create];
    }
    return self;
}

- (void)setCanModel:(CanModel *)canModel {
    NSLog(@"%@", canModel);
    NSLog(@"%@", self.canModel);
    if (_canModel != canModel) {
        [_canModel release];
        _canModel = [canModel retain];
        NSLog(@"%@", self.canModel);
        //    self.imageFace sd_setImageWithURL:[NSURL URLWithString:self.canModel]
        [self.image sd_setImageWithURL:[NSURL URLWithString:self.canModel.titlepic]];
        self.labelTitle.text = self.canModel.title;
        self.labelTitle.textAlignment = 1;
        self.labelTitle.font = [UIFont systemFontOfSize:30 weight:20];
       
        self.labelDetail.text = self.canModel.smalltext;
        self.labelDetail.font = [UIFont systemFontOfSize:20 weight:15];
        self.labelDetail.numberOfLines = 8;
        
        self.labelFirst.text = self.canModel.gongyi;
        self.labelSecond.text = self.canModel.kouwei;
        self.labelThird.text = self.canModel.mt;
        self.labelFourth.text = self.canModel.md;
        
        
        self.imageFirst.image = [UIImage imageNamed:@"findf"];
        self.imageSecond.image = [UIImage imageNamed:@"finds"];
        self.imageThird.image = [UIImage imageNamed:@"findt"];
        self.iamgeFourth.image = [UIImage imageNamed:@"findfu"];
    }

}


- (void)create{
    
    self.scrollView = [[UIScrollView alloc] initWithFrame:self.bounds];
    [self addSubview:self.scrollView];
    self.scrollView.contentSize = CGSizeMake(0, HEIGHT);
    
    self.image = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT / 100 * 35)];
    [self.scrollView addSubview:self.image];
    
    self.labelTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, HEIGHT / 100 * 35, WIDTH, HEIGHT / 100 * 10)];
    [self.scrollView addSubview:self.labelTitle];
    
    self.labelDetail = [[UILabel alloc] initWithFrame:CGRectMake(0, HEIGHT / 100 * 45, WIDTH / 100 * 50, HEIGHT / 100 * 32)];
    [self.scrollView addSubview:self.labelDetail];

    
    
    
    self.imageFirst = [[UIImageView alloc] initWithFrame:CGRectMake(WIDTH / 100 * 52,  HEIGHT / 100 * 46, WIDTH / 100 * 15, HEIGHT / 100 * 6)];
    [self.scrollView addSubview:self.imageFirst];
    
    self.imageSecond = [[UIImageView alloc] initWithFrame:CGRectMake(WIDTH / 100 * 52, HEIGHT / 100 * 54, WIDTH / 100 * 15, HEIGHT / 100 * 6)];
    [self.scrollView addSubview:self.imageSecond];
    
    self.imageThird = [[UIImageView alloc] initWithFrame:CGRectMake(WIDTH / 100 * 52, HEIGHT / 100 * 62, WIDTH / 100 * 15, HEIGHT / 100 * 6)];
    [self.scrollView addSubview:self.imageThird];
    
    self.iamgeFourth = [[UIImageView alloc] initWithFrame:CGRectMake(WIDTH / 100 * 52, HEIGHT / 100 * 70, WIDTH / 100 * 15, HEIGHT / 100 * 6)];
    [self.scrollView addSubview:self.iamgeFourth];
    
    
    self.labelFirst = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH / 100 * 70, HEIGHT / 100 * 45, WIDTH / 100 * 25, HEIGHT / 100 * 8)];
    [self.scrollView addSubview:self.labelFirst];
    
    self.labelSecond = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH / 100 * 70, HEIGHT / 100 * 53, WIDTH / 100 * 25, HEIGHT / 100 * 8)];
    [self.scrollView addSubview:self.labelSecond];
    
    self.labelThird = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH / 100 * 70, HEIGHT / 100 * 61, WIDTH / 100 * 25, HEIGHT / 100 * 8)];
    [self.scrollView addSubview:self.labelThird];
    
    self.labelFourth = [[UILabel alloc ]initWithFrame:CGRectMake(WIDTH / 100 * 70, HEIGHT / 100 * 69, WIDTH / 100 * 25, HEIGHT / 100 * 8)];
    [self.scrollView addSubview:self.labelFourth];
    
    

    
    
//    self.image.layer.borderWidth = 1;
//    self.imageFace.layer.borderWidth = 1;
//    self.labelFace.layer.borderWidth = 1;
//    self.labelFirst.layer.borderWidth = 1;
//    self.labelThird.layer.borderWidth = 1;
//    self.imageThird.layer.borderWidth = 1;
//    self.labelTitle.layer.borderWidth = 1;
//    self.imageFirst.layer.borderWidth = 1;
//    self.imageSecond.layer.borderWidth = 1;
//    self.iamgeFourth.layer.borderWidth = 1;
//    self.labelDetail.layer.borderWidth = 1;
//    self.labelFourth.layer.borderWidth = 1;
//    self.labelSecond.layer.borderWidth = 1;
 
}










@end
